package com.yuandaoma.demo;

import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;

@Controller
public class BulletController {
    @MessageMapping("/chat")
    @SendTo("/toAll/bulletScreen")             //SendTo 发送至 Broker 下的指定订阅路径
    public String say(BulletMessageVO clientMessage) {
        String result = null;
        if (clientMessage != null) {
            result = "demo-websocket:" + clientMessage.getUsername() + ":" + clientMessage.getMessage();
        }
        return result;
    }
}
